Skip to content

Add setup script and skills for Azure AI Content Understanding#48893

Open
changjian-wang wants to merge 27 commits into
mainfrom
changjian-wang/cu-sdk-skills
Open

Add setup script and skills for Azure AI Content Understanding#48893
changjian-wang wants to merge 27 commits into
mainfrom
changjian-wang/cu-sdk-skills

Conversation

@changjian-wang
Copy link
Copy Markdown
Member

This pull request introduces new developer tooling and documentation to support running and understanding Java SDK samples for Azure AI Content Understanding. The main changes include the addition of a comprehensive skill knowledge base, a robust script for running Java samples, and a setup script to prepare the local environment. These improvements make it easier for developers to get started, run, and troubleshoot sample code for the SDK.

Developer Documentation and Knowledge Base:

  • Added cu-sdk-common-knowledge skill in SKILL.md, providing detailed guidance, official documentation links, and copilot instructions for answering questions about Content Understanding concepts, analyzers, API operations, and Java SDK usage.

Sample Execution Tooling:

  • Introduced run_sample.sh script to list and execute specific Java sample classes, with support for environment variable loading, dry-run, and helpful error messages.

Sample Environment Setup:

  • Added setup_samples.sh script to automate environment setup: checks Java/Maven prerequisites, attempts to resolve the SDK from Maven Central or builds it locally, and generates a template .env file for credentials and configuration.

…AI Content Understanding Java SDK

- Created `run_sample.sh` to compile and execute Java samples with Maven.
- Added `setup_samples.sh` to check prerequisites, install SDK from Maven Central or build locally, and create a sample `.env` file.
- Introduced `SKILL.md` for interactive setup of environment variables required for running samples.
- Updated `README.md` to include information about new GitHub Copilot skills for environment setup and sample execution.
changjian-wang and others added 2 commits April 22, 2026 14:54
- Introduced `run_sample.sh` to execute specific Java samples with Maven.
- Added `setup_samples.sh` to prepare the environment, check prerequisites, and create a `.env` file.
- Created `SKILL.md` to guide users in setting up their environment variables interactively.
- Updated `README.md` to reflect new skills for environment setup and sample execution.
changjian-wang and others added 8 commits April 23, 2026 18:18
…eshooting notes for Java SDK setup

Co-authored-by: Copilot <copilot@github.com>
- Added a helper function to offer installation of JDK and Maven via package managers.
- Improved prerequisite checks for JDK and Maven, including automatic installation prompts.
- Refactored dependency installation steps to avoid redundant prompts and added a marker for dependency resolution.
- Enhanced .env file configuration with improved user prompts and automatic detection of existing model defaults.
- Introduced a PowerShell loader script for easier environment variable loading on Windows.
- Updated comments and code structure for better readability and maintainability.

Co-authored-by: Copilot <copilot@github.com>
@changjian-wang changjian-wang marked this pull request as ready for review April 30, 2026 04:28
Copilot AI review requested due to automatic review settings April 30, 2026 04:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds developer-facing tooling and documentation to make it easier to set up environment variables and run Azure AI Content Understanding Java SDK samples, along with GitHub Copilot skills that guide users through common workflows.

Changes:

  • Added a README “GitHub Copilot Skills” section and expanded navigation/next-steps links.
  • Introduced interactive setup scripts (bash + PowerShell) to validate prerequisites, resolve dependencies, and generate .env + a load-env.ps1 helper.
  • Added Copilot skill knowledge bases for setup, sample running, and domain knowledge; added a bash sample runner script.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/contentunderstanding/azure-ai-contentunderstanding/README.md Adds TOC and documents available Copilot skills with links and usage guidance.
sdk/contentunderstanding/azure-ai-contentunderstanding/.github/skills/cu-sdk-setup/scripts/setup_user_env.sh Interactive bash setup to check prerequisites, resolve deps, and create .env + loader helper.
sdk/contentunderstanding/azure-ai-contentunderstanding/.github/skills/cu-sdk-setup/scripts/setup_user_env.ps1 PowerShell equivalent of the setup flow for Windows/cross-platform PS users.
sdk/contentunderstanding/azure-ai-contentunderstanding/.github/skills/cu-sdk-setup/SKILL.md Copilot skill guidance for environment setup and troubleshooting.
sdk/contentunderstanding/azure-ai-contentunderstanding/.github/skills/cu-sdk-sample-run/scripts/run_sample.sh Adds a helper to list and run specific samples, optionally loading .env.
sdk/contentunderstanding/azure-ai-contentunderstanding/.github/skills/cu-sdk-sample-run/SKILL.md Copilot skill guidance for selecting, configuring, and running samples.
sdk/contentunderstanding/azure-ai-contentunderstanding/.github/skills/cu-sdk-common-knowledge/SKILL.md Copilot domain knowledge and official documentation pointers for Content Understanding.

- run_sample.sh: parse .env without eval; only accept NAME=VALUE assignments and warn on malformed lines, removing the command-injection risk.

- run_sample.sh: run 'mvn -DskipTests test-compile exec:java' so sample classes are compiled on a clean checkout before being executed.

- SKILL.md: soften the 'must build from repo root' wording; building from the package directory works for most users since the parent POM resolves via relativePath and dependencies come from published artifacts.
@changjian-wang changjian-wang requested a review from a team as a code owner May 8, 2026 02:26
…-skills

# Conflicts:
#	sdk/contentunderstanding/azure-ai-contentunderstanding/README.md
changjian-wang and others added 8 commits May 8, 2026 11:01
Replace 'ltrim' inline comment with 'strip leading whitespace' so cspell no longer flags it as an unknown word.
…d Sample16 coverage

- Restructure sample-run SKILL: 4 -> 6 numbered steps (Navigate, Build, Configure Env, Choose Sample, Configure Sample-Specific Settings, Run)

- Add Sample16_CreateAnalyzerWithLabels coverage: explicit Manual upload steps, training data file inventory (2 receipts x 3 files), 5-question ASK USER flow, no-training fallback, troubleshooting rows

- Add Sample_Advanced_ToLlmInput entry under Advanced Helpers

- Settings table: add Sample15 cross-resource env vars (SOURCE_RESOURCE_ID, SOURCE_REGION, TARGET_REGION, TARGET_KEY) so it matches what Sample15_GrantCopyAuth.java actually reads

- Sample16 section: clarify SAS prefix trailing slash behavior; note Java parity with Python (Option A only, no auto-upload); Portal navigation hint

- cu-sdk-setup: add ASK USER for Sample16 training data and add SAS URL/PREFIX template add-on
…improved training data handling

- Updated the sample to support two options for configuring training data:
  - Option A: Use a pre-generated SAS URL for Azure Blob Storage.
  - Option B: Automatically upload local label files and generate a User Delegation SAS URL using DefaultAzureCredential.

- Renamed "Total" field to "TotalPrice" in the field schema for consistency.
- Improved documentation to clarify the setup process for training data.
- Enhanced test cases to reflect changes in the sample and ensure proper functionality with both training data options.

Co-authored-by: Copilot <copilot@github.com>
After merging main, eng/versioning/version_client.txt expects azure-storage-blob 12.33.4 but pom.xml still pinned 12.33.3, causing the 'Verify versions in POM files' pipeline step to fail.
cspell flagged 'srcs' as an unknown word in 4 files. Replaced 'Knowledge srcs:' with 'Knowledge sources:' in the printed label across the Sample16 sync/async samples (and matching tests for consistency), the run_sample.sh DEMO MODE message, and the SKILL.md prompt. The label now matches the underlying API name (getKnowledgeSources).
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Comment thread sdk/contentunderstanding/azure-ai-contentunderstanding/pom.xml Outdated
- pom.xml: Move azure-storage-blob from compile to test scope. The dependency is only used by Sample16 (compiled as test sources) and tests, so it should not be a transitive dependency of library consumers.

- Sample16_CreateAnalyzerWithLabels.java / Async: Set SAS startsOn 5 minutes in the past to tolerate clock skew between the local machine and the storage service. Without this buffer, GetUserDelegationKey/SAS generation can intermittently fail with AuthenticationFailed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants